<?php /*a:4:{s:74:"/www/wwwroot/afanda.ccpingtai.cn/application/manage/view/contents_add.html";i:1596193156;s:66:"/www/wwwroot/afanda.ccpingtai.cn/application/manage/view/base.html";i:1596192950;s:75:"/www/wwwroot/afanda.ccpingtai.cn/application/manage/view/public_editor.html";i:1540951044;s:75:"/www/wwwroot/afanda.ccpingtai.cn/application/manage/view/public_upload.html";i:1591401853;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
	<meta name="renderer" content="webkit">
<title>后台管理系统</title>
<link rel="stylesheet" href="/static/public/awesome/css/font-awesome.min.css" />

<link rel="stylesheet" href="/static/public/layui/css/layui.css" />

<link rel="stylesheet" href="/static/public/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="/static/manage/css/style.css" />

	<link rel="stylesheet" href="/static/public/dist/zoomify.min.css">
	
<script src="/static/public/kindeditor/kindeditor-all.js"></script>
<script src="/static/public/kindeditor/lang/zh_CN.js"></script>
<script src="/static/public/ueditor/ueditor.config.js?t=<?php echo time();?>"></script>
<script src="/static/public/ueditor/ueditor.all.min.js"></script>
<script src="/static/public/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
<?php if($is_auth): ?>

<script language="javascript" type="text/javascript" src="/static/public/My97DatePicker/WdatePicker.js"></script>
<script>
    var uploadJson = '<?php echo url("api/v1/upload", ["path" => session("userid", "", session_prefix()), "module" => request()->module() ?: "addons"]); ?>';
    var fileManagerJson = '<?php echo url("api/v1/filemanager", ["sub_path" => session("userid", "", session_prefix()), "module" => request()->module() ?: "addons"]); ?>';
</script>
<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="<?php echo url('index/welcome'); ?>"><i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>cms</span>
            <span class="icon-angle-right"></span>
            <span>管理信息</span>
            <span class="icon-angle-right"></span>
            <span><?php echo htmlentities($column_name); ?></span>
            <span class="icon-angle-right"></span>
            <span><?php echo !empty($info) ? '编辑'  :  '添加'; ?>信息</span>
            <a class="u-flush"><i class="icon-repeat"></i></a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">
            <div class="m-tab-tit clearfix">
                <ul>
                    <li class="item-act"><a href="javascript:;">基本属性</a></li>
                    <li><a href="javascript:;">选项设置</a></li>
                </ul>
            </div>
            <div class="m-form mt-10">
                <form class="layui-form" id="j_form">
                    <div class="m-tab-con">
                        <table class="m-table">
                            <thead>
                                <tr>
                                    <th colspan="2">基本属性</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php if(is_array($html) || $html instanceof \think\Collection || $html instanceof \think\Paginator): if( count($html)==0 ) : echo "" ;else: foreach($html as $key=>$v): if($v['type'] == 'editor'): ?>
                                <tr>
                                    <td colspan="2"><?php echo html_entity_decode($v['label']); ?></td>
                                </tr>
                                <tr>
                                    <td colspan="2"><?php echo html_entity_decode($v['value']); ?></td>
                                </tr>
                                <script>
                                    // KindEditor.ready(function(K) {
                                    //     var editor = K.create('textarea[name="<?php echo htmlentities($v['name']); ?>"]', {
                                    // 		allowFileManager: true,
                                    //         uploadJson: uploadJson,
                                    //         fileManagerJson: fileManagerJson,
                                    //         afterBlur: function () {
                                    //             this.sync();
                                    //         }
                                    // 	});
                                    // });
                                    UE.getEditor('<?php echo htmlentities($v['name']); ?>');
                                </script>
                                <?php else: ?>
                                <tr>
                                    <td width="15%"><?php echo html_entity_decode($v['label']); ?></td>
                                    <td><?php echo html_entity_decode($v['value']); ?></td>
                                </tr>
                                <?php endif; endforeach; endif; else: echo "" ;endif; ?>
                                <tr>
                                    <td>区域</td>
                                    <td>
                                        <div class="form-select" style="display: flex">
                                            <select name="province" lay-filter="province"></select>
                                            <select name="city" lay-filter="city"></select>
                                            <select name="district"></select>
                                        </div>
                                    </td>
                                </tr>

                            </tbody>
                        </table>
                    </div>
                    <div class="m-tab-con dn">
                        <table class="m-table">
                            <thead>
                                <tr>
                                    <th colspan="2">选项设置</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td width="15%"><label for="">访问权限</label></td>
                                    <td><div class="lay-checked"><?php if(is_array($roles) || $roles instanceof \think\Collection || $roles instanceof \think\Paginator): if( count($roles)==0 ) : echo "" ;else: foreach($roles as $key=>$role): ?><input type="checkbox" name="access_role_ids[]" value="<?php echo htmlentities($role['id']); ?>" title="<?php echo htmlentities($role['name']); ?>" lay-skin="primary"<?php if(strpos(','.$info['access_role_ids'].',', ','.$role['id'].',') !== false): ?> checked<?php endif; ?> /><?php endforeach; endif; else: echo "" ;endif; ?></div></td>
                                </tr>
                                <tr>
                                    <td><label for="">审核通过</label></td>
                                    <td><div class="lay-checked"><input type="checkbox" name="checked" value="1" title="通过" lay-skin="primary" <?php if(!$info || $info['checked'] == 1): ?> checked<?php endif; ?>/></div></td>
                                </tr>
                                <tr>
                                    <td><label for="">推荐级别</label></td>
                                    <td>
                                        <div class="lay-select">
                                            <select name="isgood">
                                                <?php if(is_array($attr['isgood']) || $attr['isgood'] instanceof \think\Collection || $attr['isgood'] instanceof \think\Paginator): if( count($attr['isgood'])==0 ) : echo "" ;else: foreach($attr['isgood'] as $key=>$val): ?>
                                                <option value="<?php echo htmlentities($key); ?>"<?php if($info['isgood'] == $key): ?> selected<?php endif; ?>><?php echo htmlentities($val); ?></option>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </select>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td><label for="keywords">关键词</label></td>
                                    <td><input type="text" class="u-ipt u-ipt-long" name="keywords" id="keywords" placeholder="请输入关键词" value="<?php echo !empty($info['keywords']) ? htmlentities($info['keywords']) : ''; ?>" /></td>
                                </tr>
                                <tr>
                                    <td><label for="external_link">外部链接</label></td>
                                    <td><input type="text" class="u-ipt u-ipt-long" name="external_link" id="external_link" placeholder="请输入外部链接" value="<?php echo !empty($info['external_link']) ? htmlentities($info['external_link']) : ''; ?>" /></td>
                                </tr>
                                <tr>
                                    <td><label for="diy_browse_nums">自定义浏览量</label></td>
                                    <td><input type="text" class="u-ipt u-ipt-small" name="diy_browse_nums" id="diy_browse_nums" value="<?php echo !empty($info['diy_browse_nums']) ? htmlentities($info['diy_browse_nums']) : 0; ?>" /></td>
                                </tr>
                                <tr>
                                    <td><label for="actual_browse_nums">实际浏览量</label></td>
                                    <td><input type="text" class="u-ipt u-ipt-small" name="actual_browse_nums" id="actual_browse_nums" value="<?php echo !empty($info['actual_browse_nums']) ? htmlentities($info['actual_browse_nums']) : 0; ?>" readonly /><span>实际浏览量不可修改，只可查看。</span></td>
                                </tr>
                                <tr>
                                    <td><label for="list_order">排序</label></td>
                                    <td><input type="text" class="u-ipt u-ipt-tiny" name="list_order" id="list_order" value="<?php echo !empty($info['list_order']) ? htmlentities($info['list_order']) : 0; ?>" /><span>值越大越排在前面</span></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="m-form-btn"><input type="hidden" name="id" value="<?php echo htmlentities($info['id']); ?>"><button id="j_btn" class="u-btn">确定提交</button></div>
                    <input type="hidden" name="column_id" value="<?php echo htmlentities($column_id); ?>" />
                    <input type="hidden" name="ismember" value="0" />
                </form>
            </div>
        </div>
    </div>
</div>
<input type="hidden" name="redirect_uri" value="<?php echo url('contents/index', ['column_id' => $column_id]); ?>" />

<?php endif; ?>
<input type="hidden" name="action_uri" value="<?php echo url('action'); ?>" />

<input type="hidden" name="redirect_uri" value="<?php echo url('index'); ?>" />

<input type="hidden" name="region_uri" value="/manage/regions/regions" />
<script src="/static/public/js/jquery-1.10.2.js"></script>
<script src="/static/public/js/maniac.ui.js"></script>
<script src="/static/public/layui/layui.js" charset="utf-8"></script>
<script src="/static/public/js/aes.js"></script>
<script src="/static/public/js/mode-ecb-min.js"></script>
<script src="/static/public/js/utils.js"></script>
<script src="/static/public/js/dialog.js"></script>
<script src="/static/manage/js/form.js"></script>
<script src="/static/manage/js/js.js"></script>
<script src="/static/public/js/app.js"></script>
<script src="/static/public/js/encrypt.js"></script>
<script src="/static/public/dist/zoomify.min.js"></script>
<script type="text/javascript">
    $('.fdzoom').zoomify();
</script>

<script>
var aesKey = '<?php echo htmlentities($encrypt_key); ?>';
    $(function(){
        layui.use('layer', function(){
            var user_exists = parseInt('<?php echo !empty($user_exists) ? 1  :  0; ?>');
            var user_forbidden = parseInt('<?php echo !empty($user_forbidden) ? 1  :  0; ?>');
            var quit_force = parseInt('<?php echo !empty($quit_force) ? 1  :  0; ?>');
            var is_auth    = parseInt('<?php echo !empty($is_auth) ? 1  :  0; ?>');
            
            if (user_exists) {
                dialog.error('您所登录的用户已被删除', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (user_forbidden) {
                dialog.error('您的账户已被禁用', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }

            if (quit_force) {
                dialog.error('同一账户同一时间只能一人在线', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (!is_auth) {
                dialog.error('您没有权限执行此操作', function(){
                    window.location.href = history.go(-1);
                    return false;
                });
            }
        });
    })
</script>

<script>

    /**

     * 上传图片

     * @param  {object}  uploader upload 对象

     * @param  {string}  ele      容器选择器

     * @param  {boolean} multiple 是否允许多图上传

     */

    function upload_pic(uploader, ele, multiple)

    {

        var signature = setSign();

        uploader.render({

            elem: ele,

            field: 'imgFile',

            multiple: multiple,

            url: '<?php echo url("/manage/upload/upload", ["path" => session("userid", "", session_prefix()), "type" => "image", "module" => request()->module() ?: "addons"]); ?>',

            headers: {signature: signature},

            done: function(ret){

                var index = dialog.loading();

                if (ret.status == 0) {

                    var name = $(this.item).attr('data-name');

                    // 上传完毕回调

                    if (multiple) {

                        // 上传多图
                        $(this.item).parent().find('.m-pics ul').append('<li><img src="' + ret.data.attach_uri + '" alt="" /><input type="hidden" name="' + name + '[desc][]" value="' + ret.data.id + '" /><a class="u-item"><i class="icon icon-remove"></i></a><input type="hidden" name="' + name + '[value][]" value="' + ret.data.id + '" /></li>');
                    } else {

                        // 上传单图

                        $(this.item).parent().find('.m-pic ul').html('<li><img src="' + ret.data.attach_uri + '" alt="" /><a class="u-item"><i class="icon icon-remove"></i></a><input type="hidden" name="' + name + '" value="' + ret.data.id + '" /></li>');

                    }

                    layer.close(index);

                } else {

                    dialog.error(ret.message);

                    layer.close(index);
                }
            }
        })
    }


    /**
     * 上传图片
     * @param  {object}  uploader upload 对象
     * @param  {string}  ele      容器选择器
     * @param  {boolean} multiple 是否允许多图上传
     */
    function sxupload_pic(uploader, ele, multiple)
    {
        var signature = setSign();
        uploader.render({
            elem: ele,
            field: 'imgFile',
            multiple: multiple,
            url: '<?php echo url("api/v1/upload", ["path" => session("userid", "", session_prefix()), "type" => "image", "module" => request()->module() ?: "addons"]); ?>',
            headers: {signature: signature},
            done: function(ret){
                var index = dialog.loading();
                if (ret.status == 0) {
                    var name = $(this.item).attr('data-name');
                    // 上传完毕回调
                    if (multiple) {
                        // 上传多图
                        $(this.item).parent().find('.m-pics ul').append('<li><img src="' + ret.data.attach_uri + '" alt="" /><a class="u-item"><i class="icon icon-remove"></i></a><input type="hidden" name="' + name + '[value][]" value="' + ret.data.id + '" /></li>');
                    } else {
                        // 上传单图
                        $(this.item).parent().find('.m-pic ul').html('<li><img src="' + ret.data.attach_uri + '" alt="" /><a class="u-item"><i class="icon icon-remove"></i></a><input type="hidden" name="' + name + '" value="' + ret.data.id + '" /></li>');
                    }
                    layer.close(index);
                } else {
                    dialog.error(ret.message);

                    layer.close(index);
                }

            }

        })

    }



    /**

     * 上传附件

     * @param  {object}  uploader upload 对象

     * @param  {string}  ele      容器选择器

     */

    function upload_file(uploader, ele)

    {

        uploader.render({

            elem: ele,

            field: 'imgFile',

            accept: 'file',

            url: '<?php echo url("manage/upload/filemanager", ["path" => session("userid", "", session_prefix()), "type" => "file", "module" => request()->module() ?: "addons"]); ?>',

            done: function(ret){

                var index = dialog.loading();

                if (ret.status == 0) {

                    var name = $(this.item).attr('data-name');

                    // 上传完毕回调

                    $(this.item).parent().find('.m-files ul').append('<li><i class="icon-paper-clip"></i><input type="text" name="'+name+'[name][]" value="' + ret.data.title + '" /><a data-md5-file="' + ret.data.md5_file + '" data-id="' + ret.data.id + '" class="u-download">下载</a><a class="u-item" data-id="' + ret.data.id + '">删除</a><input type="hidden" name="' + name + '[value][]" value="' + ret.data.id + '" /></li>');

                    $(this.item).parent().find('.m-files').show();

                    layer.close(index);

                } else {

                	

                    dialog.error(ret.message);



                    layer.close(index);

                }

            }

        })

    }



    layui.use(['upload'], function(ele, multiple){

        // 得到 upload 对象

        var upload = layui.upload;

        // 上传单图

        upload_pic(upload, '.u-upload-pic', false);

        // 上传多图

        upload_pic(upload, '.u-upload-pics', true);

        // 上传附件

        upload_file(upload, '.u-upload-file');

        //双喜
        sxupload_pic(upload, '.sxu-upload-pic', false);
        sxupload_pic(upload, '.sxu-upload-pics', true);
    });

</script>
<script>
    layui.use(['layer', 'form'], function(){
        var layer  = layui.layer,
                form   = layui.form;
        var province_id ="<?php echo htmlentities($info['province']); ?>";
        var city ="<?php echo htmlentities($info['city']); ?>";
        var district ="<?php echo htmlentities($info['district']); ?>";
        //城市三级联动
        var p_options="";
        var c_options="";
        var a_options="";
        $.getJSON("/static/data/address.json", "", function(data) {
            //each循环 使用$.each方法遍历返回的数据date
            $.each(data, function(i, item) {
                // console.log(item)
                p_options+="<option value='"+item.region_id+"'>"+item.region_name+"</option>";
                if(item.region_id==province_id){
                    $.each(item.child, function(i, citem) {
                        c_options+="<option value='"+citem.region_id+"'>"+citem.region_name+"</option>";
                        if(citem.region_id==city){
                            $.each(citem.child, function(i, aitem) {
                                a_options+="<option value='"+aitem.region_id+"'>"+aitem.region_name+"</option>";
                            });
                        }
                    });
                }
            });

            //省
            $("select[name='province']").html(p_options);
            $("select[name='province'] option").attr("selected",false);
            $("select option[value='"+province_id+"']").attr("selected",true);

            $("select[name='city']").html(c_options);
            $("select[name='city'] option").attr("selected",false);
            $("select option[value='"+city+"']").attr("selected",true);

            $("select[name='district']").html(a_options);
            $("select[name='district'] option").attr("selected",false);
            $("select option[value='"+district+"']").attr("selected",true);

            form.render('select');
        });
    });
</script>

</body>
</html>